﻿using System;
using Autodesk.Revit.DB;
using Autodesk.Revit.UI;

namespace YArchitech.HVAC.AuxiliaryCurve
{
	internal class AuxiliaryFactory
	{
		public AuxiliaryFactory(ExternalCommandData cmdArgu, AuxiliaryCurveType typeArgu, double xSideArgu, double ySideArgu, int xNumberArgu, int yNumberArgu, double xDisArgu, double yDisArgu, XYZ minArgu, XYZ maxArgu, XYZ anglePtArgu, XYZ pickPointArgu, Element ElementArgu)
		{
			switch (typeArgu)
			{
			case AuxiliaryCurveType.eLineDis:
			case AuxiliaryCurveType.eArcDis:
			case AuxiliaryCurveType.eRefPlaneDis:
				this.auxiliaryCurve = new DisCurve(minArgu, maxArgu, xDisArgu, yDisArgu, xSideArgu, ySideArgu, cmdArgu, typeArgu, ElementArgu);
				return;
			case AuxiliaryCurveType.eLineDisAngle:
			case AuxiliaryCurveType.eArcDisAngle:
			case AuxiliaryCurveType.eRefPlaneDisAngele:
				this.auxiliaryCurve = new AngleDisCurve(minArgu, maxArgu, anglePtArgu, xDisArgu, yDisArgu, xSideArgu, ySideArgu, cmdArgu, typeArgu, ElementArgu);
				return;
			case AuxiliaryCurveType.eLineNumber:
			case AuxiliaryCurveType.eArcNumber:
			case AuxiliaryCurveType.eRefPlaneNumber:
				this.auxiliaryCurve = new NumberCurve(minArgu, maxArgu, xNumberArgu, yNumberArgu, xSideArgu, ySideArgu, cmdArgu, typeArgu, ElementArgu);
				return;
			case AuxiliaryCurveType.eLineNumberAngle:
			case AuxiliaryCurveType.eArcNumberAngle:
			case AuxiliaryCurveType.eRefPlaneNumberAngle:
				this.auxiliaryCurve = new AngleNumberCurve(minArgu, maxArgu, anglePtArgu, xNumberArgu, yNumberArgu, xSideArgu, ySideArgu, cmdArgu, typeArgu, ElementArgu);
				return;
			case AuxiliaryCurveType.eModelLineDis:
				this.auxiliaryCurve = new PlaneDisCurve(pickPointArgu, xDisArgu, yDisArgu, xSideArgu, ySideArgu, cmdArgu, typeArgu, ElementArgu);
				return;
			case AuxiliaryCurveType.eModelLineNumber:
				this.auxiliaryCurve = new PlaneNumberCurve(pickPointArgu, xNumberArgu, yNumberArgu, xSideArgu, ySideArgu, cmdArgu, typeArgu, ElementArgu);
				return;
			default:
				return;
			}
		}

		public bool CreateAuxiliaryCurve()
		{
			return this.auxiliaryCurve.Draw();
		}

		private AuxiliaryCurve auxiliaryCurve;
	}
}
